#include "opencv2/objdetect.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/videoio.hpp"
#include <iostream>
using namespace std;
using namespace cv;
//https://www.cnblogs.com/thunder-wu/p/6985169.html
int testreadcar(const char*filename){
	string inputName="test.jpg";
	if(filename){
		inputName=filename;
	}
	Mat image,gaus,gray,gray2,smallImg,edges;
	image = imread(samples::findFile(inputName), IMREAD_COLOR);
	imshow( "image1", image );
	GaussianBlur(image, gaus, Size(3, 3), 0, 0, BORDER_DEFAULT);
	imshow( "gaus2", gaus );
	cvtColor( gaus, gray, COLOR_BGR2GRAY );
	imshow( "gray3", gray );
	threshold(gray, gray2, 0, 255, THRESH_BINARY | THRESH_OTSU);
	imshow( "blackwite3", gray2 );
	
	gray2.convertTo(smallImg,CV_16S);
	Canny(smallImg,smallImg,edges,100,200);
	imshow( "黑白化4", edges );
	waitKey(0);
	return 0;
}